package com.wqtz.chechai.view.activities;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.wqtz.chechai.R;
import com.wqtz.chechai.base.BaseActivity;
import com.wqtz.chechai.presenter.BasePresent;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 项目名称： CheChai
 * 创建人 :  Kisum
 * 创建时间: 2017/2/6
 * 资金回执页面
 */
public class CashReceiptActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView mIvBack;
    @BindView(R.id.ll_file)
    LinearLayout mLlFile;
    @BindView(R.id.tv_explain)
    TextView mTvExplain;
    @BindView(R.id.ll_refund)
    LinearLayout mLlRefund;
    //确定
    private Button mBtnDialogExplainConfirm;


    @Override
    public void init() {
        ButterKnife.bind(this);
    }

    @Override
    public void loadData() {

    }

    @Override
    public int setContentViews() {
        return R.layout.activity_cash_receipt;
    }

    @Override
    public BasePresent createPresenter() {
        return null;
    }

    @OnClick({R.id.iv_back, R.id.ll_file, R.id.tv_explain, R.id.ll_refund})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                this.finish();
                break;
            //归档
            case R.id.ll_file:
                //上传放款回单
                Intent toUploadLoanReceiptIntent = new Intent(this, UploadLoanReceiptActivity.class);
                startActivity(toUploadLoanReceiptIntent);
                break;
            //归档资料规范说明
            case R.id.tv_explain:
                //弹出对话框
                showDialog();
                break;
            //退款
            case R.id.ll_refund:
                //上传退款回单
                Intent toUploadRefundReceiptIntent = new Intent(this, UploadRefundReceiptActivity.class);
                startActivity(toUploadRefundReceiptIntent);
                break;
        }
    }

    /**
     * 弹出对话框
     */
    private void showDialog() {
        LayoutInflater inflater = getLayoutInflater();
        final View myDialog = inflater.inflate(R.layout.dialog_explain_info, (ViewGroup) findViewById(R.id.dialog_explain));
        final Dialog dialog = new Dialog(this);
        //加载自定义的布局
        dialog.setContentView(myDialog);
        mBtnDialogExplainConfirm = (Button) myDialog.findViewById(R.id.btn_dialog_explain_confirm);
        mBtnDialogExplainConfirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        dialog.show();
    }

}
